﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using Tradex.Market;

namespace Tradex.Tests.Market {
    /// <summary>
    /// Summary description for INstrumentPricingTests
    /// </summary>
    [TestClass]
    public class InstrumentPricingTests {

        /// <summary>
        ///A test for InstrumentPricing Constructor
        ///</summary>
        [TestMethod()]
        public void Constructor_Empty () {
            string pricing = string.Empty;
            InstrumentPricing target = new InstrumentPricing(pricing);
            Assert.AreEqual(0, target.Increment);
            Assert.AreEqual(0, target.Precision);
            Assert.AreEqual(0, target.Items.Count());
        }

        /// <summary>
        ///A test for InstrumentPricing Constructor
        ///</summary>
        [TestMethod()]
        public void Constructor_Pricings() {
            string codedPricing = "[/]:0.25/2";
            InstrumentPricing target = new InstrumentPricing(codedPricing);
            Assert.AreEqual(0.25, target.Increment);
            Assert.AreEqual(2, target.Precision);
            Assert.AreEqual(codedPricing, target.ToString());

            codedPricing = "[/]:1/1";
            target = new InstrumentPricing(codedPricing);
            Assert.AreEqual(1, target.Increment);
            Assert.AreEqual(1, target.Precision);
            Assert.AreEqual(codedPricing, target.ToString());
        }
    
    }
}
